package startScreen.demo;

import important.demo.ImportantListMainActivity;
import inTheArea.demo.InTheAreaMainActivity;
import hotels.demo.HotelsMainAvtivity;
import extrasTours.demo.NewExtraMainActivity;
import finance.demo.FinanceScreenMainActivity;
import passengers.demo.PassListMainActivity;
import presence.demo.PresenceMainActivity;
import presence.demo.R;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;


public class StartScreenMainActivity extends Activity {
	

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.start_screen);
		addButtonListeners();
	}	

	
	public void addButtonListeners() {	 
		ImageButton imgButtonPassengers = (ImageButton) findViewById(R.id.PassScreenBtn);
		ImageButton imgButtonPresence = (ImageButton) findViewById(R.id.PresenceScreenBtn);
		ImageButton imgButtonNewExtras = (ImageButton) findViewById(R.id.extraScreenBtn);
		ImageButton imgButtonToDo = (ImageButton) findViewById(R.id.todoScreenBtn);
		ImageButton imgButtonMaps = (ImageButton) findViewById(R.id.mapsScreenBtn);
		ImageButton imgButtonInTheArea = (ImageButton) findViewById(R.id.inAreaScreenBtn);
		ImageButton imgButtonSchedule = (ImageButton) findViewById(R.id.scheduleScreenBtn);
		ImageButton imgButtonSchetches = (ImageButton) findViewById(R.id.schetchesScreenBtn);
		ImageButton imgButtonHotels = (ImageButton) findViewById(R.id.hotelsScreenBtn1);
		ImageButton imgButtonImportant = (ImageButton) findViewById(R.id.impoScreenBtn);
		
		
		
		imgButtonPassengers.setOnClickListener(new OnClickListener() {
		@Override
		public void onClick(View view) {
			Intent passList=new Intent(startScreen.demo.StartScreenMainActivity.this,PassListMainActivity.class);
		    startActivity(passList);		
		}
		});
		
		
		imgButtonPresence.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View view) {
				Intent presence=new Intent(startScreen.demo.StartScreenMainActivity.this,PresenceMainActivity.class);
			    startActivity(presence);		
			}
		}); 
		
		imgButtonSchetches.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View view) {
				Intent finance=new Intent(startScreen.demo.StartScreenMainActivity.this,FinanceScreenMainActivity.class);
			    startActivity(finance);		
			}
		}); 
		
		imgButtonHotels.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View view) {
				Intent hotels=new Intent(startScreen.demo.StartScreenMainActivity.this,HotelsMainAvtivity.class);
			    startActivity(hotels);		
			}
		}); 
		
		imgButtonImportant.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View view) {
				Intent important=new Intent(startScreen.demo.StartScreenMainActivity.this,ImportantListMainActivity.class);
			    startActivity(important);		
			}
		}); 
		
		imgButtonInTheArea.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View view) {
				Intent important=new Intent(startScreen.demo.StartScreenMainActivity.this,InTheAreaMainActivity.class);
			    startActivity(important);		
			}
		}); 
		
		
		//-------------------------------
		imgButtonNewExtras.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View view) {
				Intent extra=new Intent(startScreen.demo.StartScreenMainActivity.this,NewExtraMainActivity.class);
			    startActivity(extra);		
			}
		}); 
		imgButtonToDo.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View view) {
				Intent toDo;
				PackageManager manager = getPackageManager();
				try {
					toDo = manager.getLaunchIntentForPackage("com.anydo");
				    if (toDo == null)
				        throw new PackageManager.NameNotFoundException();
				    toDo.addCategory(Intent.CATEGORY_LAUNCHER);
				    startActivity(toDo);
				} catch (PackageManager.NameNotFoundException e) {

				}		
			}
		}); 
		imgButtonMaps.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View view) {
				Intent maps;
				PackageManager manager = getPackageManager();
				try {
					maps = manager.getLaunchIntentForPackage("com.google.android.apps.maps");
				    if (maps == null)
				        throw new PackageManager.NameNotFoundException();
				    maps.addCategory(Intent.CATEGORY_LAUNCHER);
				    startActivity(maps);
				} catch (PackageManager.NameNotFoundException e) {

				}		
			}
		}); 
		
				
		imgButtonSchedule.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View view) {
				Intent schedule;
				PackageManager manager = getPackageManager();
				try {
					schedule = manager.getLaunchIntentForPackage("com.android.calendar");
				    if (schedule == null)
				        throw new PackageManager.NameNotFoundException();
				    schedule.addCategory(Intent.CATEGORY_LAUNCHER);
				    startActivity(schedule);
				} catch (PackageManager.NameNotFoundException e) {

				}		
			}
		}); 
		
	}
}
